import request from './request'
//登录请求
export function login(data){
    return request({
        url:'/login',
        method:'POST',
        data
    })
}
//获取侧边栏
export function menusApi() {
  return request({
    url: '/menus',
    method: 'Get',
    
  })
}
//获取用户列表
export function userApi(params) {
  return request({
    url: '/users',
    method: 'Get',
     params
  })
}
//添加用户
export function adduserApi(data) {
   console.log('添加'+data)
  return request({
    url: '/users',
    method: 'post',
     data
    
  })
}
//更新状态
export function addstatus(id,status) {

  return request({
    url: `/users/${id}/state/${status}`,
    method: 'put'
  })
}
//修改用户角色
export function userrole(id,data) {

  return request({
    url: `/users/${id}/role`,
    method: 'put',
    data
  })
}
//删除角色
export function adddelete(id, data) {
  return request({
    url: `/users/${id}`,
    method: 'delete',
    data
  })
}
//更新角色
export function addupdate(id,data) {

  return request({
    url: `/users/${id}`,
    method: 'put',
    data
  })
}
//获取权限列表
export function rolego(type) {
  return request({
    url: `/rights/${type}`,
    method: 'get',
    
  })
}//获取树形权限列表
export function rolegos() {
  return request({
    url: `/rights/tree`,
    method: 'get',
    
  })
}//角色列表
export function roles() {
  return request({
    url: `/roles`,
    method: 'get'
  })
}//角色更新
export function roleupdate(id,data) {
  return request({
    url: `/roles/${id}`,
    method: 'put',
    data
  })
}//角色删除
export function roledelete(id, data) {
  return request({
    url: `/roles/${id}`,
    method: 'delete',
    data
  })
 
}//角色删除单个权限
export function delroledelete(id, ids) {
  return request({
    url: `roles/${id}/rights/${ids}`,
    method: 'delete',
    
  })
 
}//角色添加
export function addrole(data) {
  return request({
    url: `/roles`,
    method: 'post',
    data
  })
}//角色赋权

export function rightupdate(id, data) {
  return request({
    url: `roles/${id}/rights`,
    method: 'post',
    data
  })
}
//商品列表
export function Goods(params) {
  return request({
    url: `goods`,
    method: 'get',
    params
  })
}
//商品修改
export function EditGoods(id, data) {
  return request({
    url: `goods/${id}`,
    method: 'put',
    data
  })
}
// 删除商品
export function DelGoods(id) {
  return request({
    url: `goods/${id}`,
    method: 'delete'
  })
}
// 删除分类
export function deleteclass(id) {
  return request({
    url: `categories/${id}`,
    method: 'delete'
  })
}
//分类列表
export function categories(params) {
  return request({
    url: `categories`,
    method: 'get',
    params
  })
}
//添加分类
export function AddCate(data) {
  return request({
    url: `categories`,
    method: 'post',
    data
  })
}
//编辑分类
export function cate(id,data) {
  return request({
    url: `categories/${id}`,
    method: 'put',
    data
  })
}
//添加商品
export function AddGoods(data) {
  return request({
    url: `goods`,
    method: 'post',
    data
  })
}
//获取分类
export function CanShu(id, params) {
  return request({
    url: `categories/${id}/attributes`,
    method: 'get',
    params
  })
}
//添加动态参数或者静态属性
export function goodtypeadd(id,data) {
  return request({
    url: `categories/${id}/attributes`,
    method: 'post',
    data
  })
}
export function FenLei() {
  return request({
    url: `categories`,
    method: 'get'
  })
}
export function goodsDataAddCanApi(id,fff) {
  return request({
    url: `categories/${id}/attributes`,
    method: 'get',
    params: {sel:fff}
  })
}
//编辑参数

export function paramsEdit(id,ids,data) {
  return request({
    url: `categories/${id}/attributes/${ids}`,
    method: 'put',
    data
  })
}
export function paramsDelete(id, ids) {
  return request({
    url: `categories/${id}/attributes/${ids}`,
    method: 'delete',
   
  })
}
// 订单列表
export function OrderList(params){
  return request({
    url:`orders`,
    method:'GET',
    params,

  })
}
// 物流信息
export function WuLiu(id){
  return request({
    url:`kuaidi/${id}`,
    method:'GET',


  })
}
export function GetTo(){
  return request({
    url:`reports/type/1`,
    method:'GET',

  })
}